﻿#include "PhyscisPropBeamWapper.h"
#include "FITK_Kernel/FITKAppFramework/FITKMessage.h"

Beam * PhyscisPropBeamWapper::new_Beam()
{
    return new Beam;
}
void PhyscisPropBeamWapper::delete_Beam(Beam * obj)
{
    if (obj) delete obj;
}

Beam * PhyscisPropBeamWapper::static_Beam_GetBeam(const QString & name)
{
    return new Beam(name);
}

QString PhyscisPropBeamWapper::getName(Beam * obj)
{
    if (obj)
        return obj->getName();
    return QString();
}

void PhyscisPropBeamWapper::setName(Beam * obj, const QString & name)
{
    if (!obj)return;
    bool ok = obj->setName(name);
    if (!ok) {
        AppFrame::FITKMessageError("Set Name failed !");
    }
}

void PhyscisPropBeamWapper::setMoments(Beam * obj, double Ixx, double Iyy, double Jzz, double Qzz)
{
    if (!obj)return;
    bool ok = obj->setMoments(Ixx, Iyy, Jzz, Qzz);
    if (!ok) {
        AppFrame::FITKMessageError("Set Moments failed !");
    }
}

void PhyscisPropBeamWapper::setCrossSection(Beam * obj, double area, double perimeter)
{
    if (!obj)return;
    bool ok = obj->setCrossSection(area, perimeter);
    if (!ok) {
        AppFrame::FITKMessageError("Set Cross Section Properties failed !");
    }
}

void PhyscisPropBeamWapper::setShearCenterOffset(Beam * obj, double ShearOffsetX, double ShearOffsetY)
{
    if (!obj)return;
    bool ok = obj->setShearCenterOffset(ShearOffsetX, ShearOffsetY);
    if (!ok) {
        AppFrame::FITKMessageError("Set Shear Center Offset failed !");
    }
}

void PhyscisPropBeamWapper::setMaterial(Beam * obj, const QString & material)
{
    if (!obj)return;
    bool ok = obj->setMaterial(material);
    if (!ok) {
        AppFrame::FITKMessageError("Set Material failed !");
    }
}

void PhyscisPropBeamWapper::createPhyscisProp(Beam * obj, const QString & name)
{
    if (!obj)return;
    bool ok = obj->createPhyscisProp(name);
    if (!ok) {
        AppFrame::FITKMessageError("Create Physcis Property failed !");
    }
}

Beam::Beam(const QString & name):
    Acoustics::PyFITKPhyscisPropBeam(name)
{
}

Beam::Beam() :
    Acoustics::PyFITKPhyscisPropBeam()
{
}
